The present disclosure describes systems and techniques relating to program flow control, for example, synchronizing parallel processes.
A process is an executing software program, which may or may not share resources with other processes. Parallel processes are two or more processes that operate together in a computing system (e.g., parallel threads of a program) and share at least one system resource that may not be accessible by all the parallel processes together (e.g., a shared memory resource that may be corrupted if accessed in parallel by multiple processes). Access to such shared resources frequently needs to be synchronized, and this is typically done by placing shared-resource-access operations in a critical section of a program.
A critical section of a program may enforce serialized access to a shared resource among parallel processes. Traditionally this has been done using some form of atomic operation. An atomic operation is multiple sub-operations on a resource (e.g., read, modify and then write to a memory location) that the processor architecture forces to be performed together by not allowing multiple processes to overlap their performance of the multiple sub-operations. For example, an atomic read-modify-write instruction may be provided for use with a lock variable for a critical section; or support for a semaphore may be provided for use in controlling how many parallel processes can access a critical section. Thus, the processor architecture enables a simple shared resource to be made into a protected resource (e.g., a protected variable), which must be shared sequentially because of the processor architecture itself, allowing programmers to synchronize access to any number, and type of shared resources.
Details of one or more embodiments are set forth in the accompanying drawings and the description below. Other features and advantages may be apparent from the description and drawings, and from the claims.